package game.farming.model;

import java.util.Random;
import java.util.Stack;

public class Dice{
	private int maxVal;
	private int minVal;
	private int range;
	private int lastVal;
	
	private Random rand;
	
	private Stack<Integer> history;
	
	public Dice( int num ){
		history = new Stack<Integer>();
		minVal = num;
		maxVal = num * 6;
		range = maxVal + 1 - minVal;
		rand = new Random();
		lastVal = 0;
	}

	public int last(){
		return getLastVal();
	}
	
	public int getLastVal(){
		return lastVal;
	}
	
	public int next(){
		return getNextVal();
	}
	
	public int getNextVal(){
		lastVal = rand.nextInt(range) + minVal;
		history.push( lastVal );
		return lastVal;
	}
}
